//////////////////////////////////////////////////////////////////////
//
//  THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
//  ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED
//  TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
//  PARTICULAR PURPOSE.
//
//  Copyright (C) Microsoft Corporation.  All rights reserved.
//
//  Globals.cpp
//
//          Global variables
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "globals.h"

HINSTANCE g_hInst;

LONG g_cRefDll = -1; // -1 /w no refs, for win95 InterlockedIncrement/Decrement compat

CRITICAL_SECTION g_cs;


// {C45A43AE-B343-4291-AC22-52BDFD009C66}
static const GUID c_clsidTextService= 
{ 0xc45a43ae, 0xb343, 0x4291, { 0xac, 0x22, 0x52, 0xbd, 0xfd, 0x0, 0x9c, 0x66 } };


// {E429C713-CECE-4A61-8ACC-BE4F123DA5E4}
static const GUID c_guidProfile= 
{ 0xe429c713, 0xcece, 0x4a61, { 0x8a, 0xcc, 0xbe, 0x4f, 0x12, 0x3d, 0xa5, 0xe4 } };


// {80FDA9E8-1C93-4B5F-9994-5C55EF8A65D3}
static const GUID c_guidLangBarItemButton = 
{ 0x80fda9e8, 0x1c93, 0x4b5f, { 0x99, 0x94, 0x5c, 0x55, 0xef, 0x8a, 0x65, 0xd3 } };


//+---------------------------------------------------------------------------
//
// IsRangeCovered
//
// Returns TRUE if pRangeTest is entirely contained within pRangeCover.
//
//----------------------------------------------------------------------------

BOOL IsRangeCovered(TfEditCookie ec, ITfRange *pRangeTest, ITfRange *pRangeCover)
{
    LONG lResult;

    if (pRangeCover->CompareStart(ec, pRangeTest, TF_ANCHOR_START, &lResult) != S_OK ||
        lResult > 0)
    {
        return FALSE;
    }

    if (pRangeCover->CompareEnd(ec, pRangeTest, TF_ANCHOR_END, &lResult) != S_OK ||
        lResult < 0)
    {
        return FALSE;
    }

    return TRUE;
}
